//
//  ZAssetsLibrary.h
//  danpin
//
//  Created by chuangjia on 5/8/15.
//  Copyright (c) 2015 chuangjia. All rights reserved.
//

@import AssetsLibrary;
#import "ZAssetImageFile.h"

typedef void(^ZAssetsSaveImageCompletion)(NSError* error);
typedef void(^ZAssetsLoadImagesCompletion)(NSArray *items, NSError *error);



@interface ZAssetsLibrary : ALAssetsLibrary

+ (instancetype) new __attribute__
((unavailable("[+new] is not allowed, use [+defaultAssetsLibrary]")));

- (instancetype) init __attribute__
((unavailable("[-init] is not allowed, use [+defaultAssetsLibrary]")));

+ (ZAssetsLibrary *)defaultAssetsLibrary;

- (void)deleteFile:(ZAssetImageFile *)file;

- (NSArray *)loadImagesFromDocumentDirectory;
- (void)loadImagesFromAlbum:(NSString *)albumName withCallback:(ZAssetsLoadImagesCompletion)callback;

- (void)saveImage:(UIImage *)image completion:(ZAssetsSaveImageCompletion)completion;
- (void)saveImage:(UIImage *)image withAlbumName:(NSString *)albumName completion:(ZAssetsSaveImageCompletion)completion;
- (void)saveJPGImageAtDocumentDirectory:(UIImage *)image;

@end
